package edu.maping.easy;

import processing.core.PApplet;
import controlP5.ControlGroup;
import controlP5.ControlP5;
import controlP5.Controller;

public class ControlManager extends ControlP5 implements ControlFacade {

	private ControlGroup controlGroup;

	private static int WINDOW_WIDTH = 100;

	private int id = 0;
	
	private ControlGroup mainGroup;
	
	public ControlManager(PApplet arg0) {
		super(arg0);
		init(arg0);
	}

	public int addController(Controller controller) {
		controller.setGroup(controlGroup);
		id++;
		controller.setId(id);
		return id;
	}

	public void init(PApplet pApplet) {
		controlGroup = addGroup("Polygon", pApplet.width - WINDOW_WIDTH, 60);
		controlGroup.hideBar();
		controlGroup.setVisible(false);
	}

	@Override
	public ControlGroup getGroup() {
		return controlGroup;
	}

	public ControlGroup getMainGroup() {
		return mainGroup;
	}

	public void setMainGroup(ControlGroup mainGroup) {
		this.mainGroup = mainGroup;
	}
	
}
